import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '@/pages/login/login'
import profile from '@/pages/profile/profile'
import info from '../pages/profile/children/info'
import modloginpwd from '@/pages/profile/children/children/modloginpwd'
import setusername from '@/pages/profile/children/children/setusername'
import balance from '@/components/balance/balance'
import baldtl from '@/components/balance/children/baldtl'
import deposit from '@/components/balance/children/deposit'
import pay from '@/components/balance/children/pay'
import payWechat from '@/components/balance/children/payWechat'
import txnret from '@/components/balance/children/txnret'
import errdesc from '@/components/balance/children/errdesc'
import points from '@/components/points/points'
import benefit from '@/components/benefit/benefit'
import msite from '@/components/msite/msite'
import food from '@/components/msite/food/food'
import search from '@/components/search/search'
import order from '../components/order/order'
import rent from '@/pages/rent'
import rentcont from '@/pages/rent/contract'
import contractdtl from '@/pages/rent/contract/children/contractdtl'
import newcontract from '@/pages/rent/contract/children/newcontract'
import rentorder from '@/pages/rent/order'
import orderdtl from '@/pages/rent/order/children/orderdtl'
import modorder from '@/pages/rent/order/children/modorder'
import App from '../App'

Vue.use(VueRouter)

export default new VueRouter({
  routes: [{
    path: '/',
    component: App,
    children: [
      {
        path: '',
        component: profile
      },
      {
        path: 'profile',
        component: profile,
        children: [{
          path: 'info',         // 用户信息详情页
          component: info,
          children: [
          {
            path: 'modloginpwd',
            component: modloginpwd
          },
          {
            path: 'setusername',
            component: setusername
          }]
        }]
      },
      // {
      //   path: 'forget',
      //   component: forget
      // },
      { // 登录注册页
        path: 'login',
        component: login
      },
      { // 所有商铺列表页
        path: 'msite',
        component: msite,
        meta: { keepAlive: true },
        children: [
          //特色商铺列表页
          {
            path: '/food',
            component: food
          }
        ]
      },
      { // 搜索页
          path: '/search/',
          component: search
      },
      // 订单
      {
        path: 'order',
        component: order
      },
      { //余额
        path: 'balance',
        component: balance,
        children: [{
          path: 'baldtl',
          component: baldtl
        },
        {
          path: 'deposit',
          component: deposit
        },
        {
          path: 'pay',
          component: pay
        },
        {
          path: 'payWechat',
          component: payWechat
        },
        { // 交易返回页
          path: 'txnret',
          component: txnret
        },
        { // 错误详情页
          path: 'errdesc',
          component: errdesc
        }
        // {
        //   path: 'withdraw',
        //   component: deposit
        // }
        ]
      },
      { // 我的积分页
        path: 'points',
        component: points
      },
      { // 我的优惠页
        path: 'benefit',
        component: benefit
      },
      { // 我的付房租
        path: 'rent',
        component: rent
      },
      { // 交房租-合同
        path: 'rent/contract',
        component: rentcont,
        children: [{
          path: 'newcontract',
          component: newcontract
        }, {
          path: 'detail',
          component: contractdtl
        }]
      },
      { // 交房租-订单
        path: 'rent/order',
        component: rentorder,
        children: [{
          path: 'detail',
          component: orderdtl
        }]
      }
    ]
  }]
})
